'use strict';function _Mu(a){if(!a||"string"!=typeof a&&!a.templ)return a;let b=_dd(a.templ?a.templ:a).nodes[0].value;for(let c of b)_s(c);a={templ:b,regex:a.regex,flags:a.flags,ignoreCase:a.ignoreCase};1==a.templ.length&&"string"==typeof a.templ[0]&&(a=_cd(a,a.templ[0]));return a}function _cd(a,b){if(a.regex)try{return new RegExp(b,a.flags||(a.ignoreCase?"i":""))}catch(c){return/.^/}return a.ignoreCase?b.toUpperCase():b}
function _s(a){if(a&&a.expr)for(let b of a.expr)if(b.args)for(a=0;a<b.args.length;++a)_s(b.args[a]),b.args[a]=_Mu(b.args[a])}function _yy(a,b=null){if(!a||!a.templ)return a;let c="";for(let d of a.templ)c+=d.expr?_Sk(d,b):d;return _cd(a,c)}function _6s(a,b=null){if(!a||!a.templ)return[a];let c=[""];for(let d of a.templ)if(d.expr){a=[];let e=_3y(_Sk(d,b));for(let f of c)for(let g of e)a.push(f+g);c=a}else for(a=0;a<c.length;++a)c[a]+=d;return c}
function _Sk(a,b){let c=_yi(a.expr[0],b);for(let e=1;null!=c&&e<a.expr.length;++e){let f=a.expr[e];var d=_Gf.hasOwnProperty(f.name)?function(...g){return _Mg(this)?this.map(h=>_Gf[f.name].apply(h.toString?h.toString():"",g)):_Gf[f.name].apply(this.toString?this.toString():"",g)}:c[f.name];c="function"==typeof d?d.apply(c,(f.args||[]).map(g=>g.expr?_Sk(g,b):_yy(g))):d}return void 0===c&&1==a.expr.length?`<${a.expr[0].name}>`:null==c?"(empty)":c}
const _Gf={match(a){return(this.match(a)||[""])[0]},matches(a){return this.match(a)||[]},replace(a,b){return this.replace(a instanceof RegExp?a.global?a:RegExp(a.source,"g"+a.flags):RegExp(_At(""+a),"g"),b)},escape(){return encodeURIComponent(this).replace(/%20/g,"+")},unescape(){return unescape(this)},lines(){return this.trim().split(/\s*\n\s*/)},words(){return this.trim().split(/\s+/)},url(){return new Proxy(new String(_Np(this)),{get:_dk})}};
let _yf,_Ij,_Rj={},_zd={},_Tg=_wj(function*(a){if(null==_Rj[a]){let b=yield _fw(_su,_Dg[a]);_Rj[a]="string"==typeof b?b:""}return _Rj[a]}),_po=_wj(function*(a){null==_zd[a]&&(_zd[a]=yield _fw(_7u,a));return _zd[a]});
var _9y=_wj(function*(a){if(!a)return a;const b=/<(\w+)>/g;let c={};a=_3y(a);for(let d=0;d<a.length;++d){let e=a[d].match(b);if(e){for(let f of e)f=f.slice(1,-1).toLowerCase(),c.hasOwnProperty(f)||(c[f]=_Dg[f]?yield _Tg(f):yield _po(f));a[d]=a[d].replace(b,(f,g)=>c[g.toLowerCase()])}}return 1==a.length?a[0]:a});
{let a={};var _yi=function(b,c){switch(b.name.toLowerCase()){case "clipboard":if(c=_Kg(b.args,0))return _Ud[c]||"";_Lw()&&_Hu.addFunc(_Sj);return _8f.content;case "omnibox":return null==_yf&&_Ba[_Pd]&&_Hu.addFunc(_Ii(function*(){null==_yf&&(_yf=yield _fw(_Kt,_Ba[_Pd]))})),_yf||"";case "selection":return null==_Ij&&_Hu.addFunc(_Ii(function*(){null==_Ij&&(_Ij=(yield _Jj(1E3*(+_Kg(b.args,0)||.5))).content||"")})),_Ij||"";case "date":return _ql(new Date,"string"==typeof _Kg(b.args,0)?b.args[0]:"Y-M-D");
case "var":return new Proxy(a,{get(d,e){if("string"!=typeof e||_Vy(e,"toString","valueOf"))return d[e];if(d.hasOwnProperty(e)){let f=d[e];delete d[e];return void 0===f?"":f}_Hu.addFunc(_Ii(function*(){d[e]=yield _7d("",e)}));return" "}});case "dir":return new Proxy(_Rj,{get(d,e){if("string"!=typeof e||_Vy(e,"toString","valueOf"))return d[e];e=e.toLowerCase();if(!_Dg[e])return"";if(d.hasOwnProperty(e))return d[e];_Hu.addFunc(_Tg(e));return" "}});case "env":return new Proxy(_zd,{get(d,e){if("string"!=
typeof e||_Vy(e,"toString","valueOf")||d.hasOwnProperty(e))return d[e];_Hu.addFunc(_po(e));return" "}});default:return _Qy(c,b.name)}}}function _ra(){if(null!=_bj)return _bj;_Hu.addFunc(_Ii(function*(){_bj=(yield _6w(null,_7o(_wy).usePrevMousePos))||0}));return 0}function _wk(a){return a.active&&a.highlighted?a.window.tabs.some(b=>!b.active&&b.highlighted):a.highlighted}let _eh,_ir;
function _Cp(){if(_eh)return _eh;_ir||(_ir=!0,_Hu.addFunc(_Ii(function*(){for(var a={usePrvMsPos:!!_7o(_wy).usePrevMousePos};;){a=(yield _fw(_wo,a))||{};const b=_bj=_Rk[a.hWnd];let c=[];if("index"in a)c=yield _By({windowId:b,index:a.index});else if("title"in a&&((c=yield _9j(b,a.title))||(c=[yield d=>_Yt(b,d)]),1!=c.length)){a={x:a.x,y:a.y,getIdx:!0};continue}a.group&&c[0]&&c[0].groupId&&(c=yield _By({windowId:b,groupId:c[0].groupId}));_eh=c.map(d=>_Rh(d));break}_ir=!1})));return[]}
let _9j=_wj(function*(a,b){if(!b)return[];const c=500==b.length;for(;;){var d=b.replace(/\*|\?/g,"\\$&");c&&(d+="*");if((d=yield _By({windowId:a,title:d}))&&0==d.length){let e=b.lastIndexOf(" - ");if(0<e){b=b.slice(0,e);continue}}return d}}),_bu=_wj(function*(a,b){if(!b)return[];for(let d=0;;){d=b.indexOf(" - ",d+1);-1==d&&(d=void 0);var c=b.slice(0,d).replace(/\*|\?/g,"\\$&");d&&(c+="*");c=yield _By({windowId:a,title:c});if(!d||!c||1>=c.length)return c}});
function _Vk(a){return 0<=_tf.indexOf(a)}let _Ro={};function _xu(a){if(null!=_Ro[a])return _Ro[a];_Ro[a]=null;_Ro.pending||(_Ro.pending=!0,_Hu.addFunc(_Ii(function*(){yield _Pi();delete _Ro.pending;_Ro=yield _3i(Object.keys(_Ro).map(b=>+b))})));return!1}
function _Qy(a,b){if(!a)return"";switch(b){case "url":return new Proxy(new String(_7j(a)),{get:_dk});case "domain":case "mainDomain":case "dirPath":case "path":return _dk(_7j(a),b);case "muted":return a.mutedInfo.muted;case "monitorId":return _Jg(a.window);case "window":return new Proxy(a.window,{get(c,d){switch(d){case "underMouse":return c.id==_ra();case "state":return _Vk(c.id)?"hidden":c.state;case "focused":return _Hd(c);case "alwaysOnTop":return _xu(c.id)}return c[d]}});case "status":return a.discarded?
"discarded":a.status;case "index":return a.index+1;case "selected":case "highlighted":return _wk(a);case "openerTabId":return a.openerTabId||_Xe(a.id);case "used":return 0<=_Ek.indexOf(a.id);case "hovered":return 0<=_Cp().indexOf(a.id);case "grouped":return 0<a.groupId;case "contType":return"";default:return a[b]}}function _Xe(a){if(a=_Ne[a])return a in _os?a:_Xe(a)}
function _dk(a,b){switch(b){case "protocol":return(new URL(a)).protocol;case "user":return(new URL(a)).username;case "domain":return(new URL(a)).hostname;case "mainDomain":return _la((new URL(a)).hostname);case "port":return(new URL(a)).port;case "path":return(new URL(a)).pathname;case "dirPath":return(new URL(a)).pathname.replace(/[^\/]+$/,"");case "query":return new Proxy(new String((new URL(a)).search),{get:_Sd});case "fragment":return(new URL(a)).hash}b=a[b];"function"==typeof b&&(b=b.bind(a));
return b}function _Sd(a,b){let c=a[b];"function"==typeof c?c=c.bind(a):void 0===c&&"string"==typeof b&&(a=(new URLSearchParams(a.slice(1))).getAll(b),c=1>=a.length?a[0]:a);return c}function _la(a){let b=a.match(/[^.]+(?:\.(?:gov|com|org|edu|net|co|mil|eu|ac|info|biz|leg|int|nom|name|gob|web))?\.(?!\d+)[^.]+$/i);return b?b[0]:a}function _6i(a,b){let c=!1,d=Object.keys(_os)[0],e=new Proxy(_os[d]||{},{get(f,g){g in f&&(!b||"url"!=g)&&(c=!0);return f[g]}});_ah(0,()=>_yy(_Mu(a),e))(_Qu);return c}
let _dd=(()=>{let a={ident:b=>({value:b}),num:b=>({value:+b}),str:b=>({value:_Vj(b.slice(1,-1),"nrt'\"\\")}),regexBody:b=>({value:_Vj(b.slice(1,-1),"/")}),regexFlags:b=>({value:b}),regex:()=>({value:{regex:!0},addChild(b){this.value[this.value.templ?"flags":"templ"]=b.value}}),argList:()=>({value:[],addChild(b){this.value.push(b.value)}}),exprComp:()=>({value:{},addChild(b){this.value[this.value.name?"args":"name"]=b.value}}),expr:()=>({value:{expr:[]},addChild(b){this.value.expr.push(b.value)}}),
text:b=>({value:b}),templateStr:()=>({value:[],addChild(b){"string"==typeof this.value[this.value.length-1]&&"string"==typeof b.value?this.value[this.value.length-1]+=b.value:this.value.push(b.value)}})};a.exprComp2=a.exprComp;a.text2=a.text;return _Xf({blank:/\s*/,ident:/[a-z_]\w*/i,num:/[+-]?\d+(\.\d*)?/,str:/(["'])((?!\1)[^\\]|\\.)*\1/,regexBody:/\/([^\\\/]|\\.)*\//,regexFlags:/[a-z]{1,10}/i,regex:" regexBody regexFlags? ",value:"str|regex|num|expr",argList:'"(" (value ("," value)*)? ")"',exprComp:"ident argList?",
exprComp2:'"[" value "]" argList?',expr:' exprComp ( ("." exprComp) | exprComp2 )* ',text:/[^<]+/,text2:/<[^<]*/,templateStr:' (text | ( "<" . expr . ">" ) | text2)* '},"templateStr",a)})();
